<?php
if (! defined ( 'BASEPATH' ))
	exit ( 'No direct script access allowed' );
class Categories extends MX_Controller {

	var $_table = 'categories';

	function __construct() {
		parent::__construct ();

		$_SESSION ['KCFINDER'] = array ();
		$_SESSION ['KCFINDER'] ['disabled'] = false;

		$this->load->library ( 'ckeditor', array ('instanceName' => 'CKEDITOR1', 'basePath' => base_url () . "ckeditor/", 'outPut' => true ) );
		$this->load->model ( 'categories_model' );
		if (!isset($this->session->userdata['language'])){
			$this->session->userdata['language']='';
			$this->session->set_userdata('data_language', '');
		}
		$this->lang->load('system', $this->session->userdata['language']);
	}

	function detail() {
		$id = ($this->uri->segment ( 3 ) == '') ? 0 : $this->uri->segment ( 3 );
		$detail = $this->categories_model->getCatDetail ($id);

		$data ['detail'] = $detail;
		$data ['posts'] = $this->categories_model->getPostList ($id);

		$data ['content'] = 'detail';
		$this->load->view ( 'front_end/index', $data );
	}

	function postDetail(){
		$post_name='subject'.$this->session->userdata['data_language'];
		$post_content='post_content'.$this->session->userdata['data_language'];
		$id = ($this->uri->segment ( 3 ) == '') ? 0 : $this->uri->segment ( 3 );
		$detail = $this->categories_model->getPostDetail ($id);
		$html_detail='<h4 class="detail-t">'.$detail->$post_name.'</h4>'.$detail->$post_content;
		echo $html_detail;
	}
	
	function recruitment() {
//		$id = ($this->uri->segment ( 3 ) == '') ? 0 : $this->uri->segment ( 3 );
//		$detail = $this->categories_model->getCatDetail ($id);
//
//		$data ['detail'] = $detail;
		$data ['posts'] = $this->categories_model->getRecruitments ();

		$data ['content'] = 'detail';
		$this->load->view ( 'front_end/index', $data );
	}
}